package com.sk.waste.app.utils;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.lc.smc.lib.R;

public class LcProgressUtil
  {
    private Dialog mDialog;
    private TextView mTextView;
    private LinearLayout rootView;

    public LcProgressUtil(Context context)
      {
        mDialog = new Dialog(context, R.style.lc_style_dialog);
        View view = LayoutInflater.from(context).inflate(R.layout.view_dialog_progress, null);
        mTextView = view.findViewById(R.id.textview);
        rootView = view.findViewById(R.id.root_view);
        setCancelable(false);
        mDialog.setContentView(view);
      }

    public void show()
      {
        if (!mDialog.isShowing())
          mDialog.show();
      }

    public Boolean isShow()
      {
        return mDialog.isShowing();
      }

    public void setText(String text)
      {
        mTextView.setText(text);
      }

    public void setText(int textID)
      {
        mTextView.setText(textID);
      }

    public void setTextColor(int color)
      {
        mTextView.setTextColor(color);
      }

    public void setTextBackground(int resId)
      {
        mTextView.setBackgroundResource(resId);
      }

    public void setRootViewBackground(int resId)
      {
        rootView.setBackgroundResource(resId);
      }

    public void setCancelable(boolean cancelable)
      {
        mDialog.setCancelable(cancelable);
      }

    public void cancel()
      {
        if (mDialog.isShowing())
          {
            mDialog.cancel();
          }
      }

  }
